package com.dragon.common.constant;


import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;


/**
 * 自定义上下文
 */
@Component
public class ContextConfig {

    private static final String KEY_CURRENT_TENANT_ID="KEY_CURRENT_PROVIDER_ID";
    private static final Map<String,Object> M_CONTEXT= new ConcurrentHashMap<>();

    public static void setCurrentTenantId(String tenantId){
        M_CONTEXT.put(KEY_CURRENT_TENANT_ID,tenantId);
    }

    public static String getCurrentTenantId(){
        return (String) M_CONTEXT.get(KEY_CURRENT_TENANT_ID);
    }
}